<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	SoptHashMap hm = RequestManager.getRequest(request);
	
	CategoryProc category = new CategoryProc();
	BoardProc board = new BoardProc();
	AuctionProc auction = new AuctionProc();
	
	ArrayList avalibleGoodsList = auction.getAvalibleGoodsList();
	ArrayList registedGoodsList = auction.getRegistedGoodsList();
	ArrayList awardedGoodsList = auction.getAwardedGoodsList();
	ArrayList boardList = board.getBoardList("",1,0);
	ArrayList categoryList = category.getCategoryList("");
	
	if(hm.get("ACTIONTYPE")!=null){
		String curAction = hm.get("ACTIONTYPE").toString();
		if(curAction.equals("regCategory")){
			category.regCategory(request);
		}else if(curAction.equals("regBoard")){
			board.regBoard(request);
		}else if(curAction.equals("regGoods")){
			auction.regGoods(request);
		}
	}
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="styledaco.board.CategoryProc"%>
<%@page import="java.util.ArrayList"%>
<%@page import="comm.util.SoptHashMap"%>
<%@page import="comm.util.RequestManager"%>
<%@page import="styledaco.board.BoardProc"%>
<%@page import="styledaco.auction.AuctionProc"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>StyleDaco관리자</title>
<script type="text/javascript" src="http://<%=request.getServerName()+request.getContextPath()%>/jsp/admin/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://<%=request.getServerName()+request.getContextPath()%>/jsp/admin/admin.js"></script>
</head>
<body>
	<div>
		<h2>카테고리(게시판) 등록</h2>
		<form action="" method="post">
			<input type="hidden" name="actionType" value="regCategory">
			게시판 이름:<input type="text" name="category_name">
			게시판 구분 숫자:<input type="text" name="category_type">
			<input type="submit" value="저장">
		</form>
		<h2>현재 카테고리</h2>
		<div>
			<%if(categoryList!=null && categoryList.size()>0){ 
				for(int i = 0; i< categoryList.size();i++){
					SoptHashMap curCategory = (SoptHashMap)categoryList.get(i);%>
					<div>카네고리 번호:<%=curCategory.get("CATEGORY_SEQ") %> / <%=curCategory.get("CATEGORY_NAME") %> / 타입:<%=curCategory.get("CATEGORY_TYPE") %></div>
				<%} %>
			<%}else{ %>
				<div>등록된카테고리(게시판)가 없습니다.</div>
			<%} %>
		</div>
	</div>
	
	<div>
		<h2>게시판 글 등록</h2>
		<form action="" method="post">
			<input type="hidden" name="actionType" value="regBoard">
			카네고리 번호 : <input type="text" name="category_seq">
			글제목:<input type="text" name="board_title">
			글 내용:<textarea name="board_content"></textarea>
			<input type="submit" value="저장">
		</form>
		<h2>현재 등록된 글들</h2>
		<div>
			<%if(boardList!=null && boardList.size()>0){ 
				for(int i = 0; i< boardList.size();i++){
					SoptHashMap curBoard = (SoptHashMap)boardList.get(i);%>
					<div>카테고리번호:<%=curBoard.get("CATEGORY_SEQ") %> / <%=curBoard.get("BOARD_TITLE") %> / <%=curBoard.get("BOARD_REGDATE") %></div>
				<%} %>
			<%}else{ %>
				<div>등록된카테고리(게시판)가 없습니다.</div>
			<%} %>
		</div>
	</div>
	<div></div>
	
	<div>
		<h2>물품 등록</h2>
		<div>
			<%@include file="imgUploadForm_s.jsp" %>
		</div>
		<div>
			<%@include file="imgUploadForm_b.jsp" %>
		</div>
		<form action="" method="post">
			<input type="hidden" name="actionType" value="regGoods">
			<input type="hidden" name="goods_b_image" id="goods_b_image" value="">
			<input type="hidden" name="goods_s_image" id="goods_s_image" value="">
			제품이미지(소):<img id="img_b" src=""/>
			제품이미지(대):<img id="img_s" src=""/>
			상품명:<input type="text" name="goods_name" value="">
			회사:<input type="text" name="goods_company" value="">
			간략한소개(상세소개는 게시판연동시 작성하삼):<input type="text" name="goods_intro" value="">
			경매 언제까지 : <input type="text" name="goods_award_date">ex) 2010-03-10
			<input type="submit" value="저장">
		</form>
		<h2>현재 경매등록 가능한 물건</h2>
		<div>
			<%if(avalibleGoodsList!=null && avalibleGoodsList.size()>0){ 
				for(int i = 0; i< avalibleGoodsList.size();i++){
					SoptHashMap curGoods = (SoptHashMap)avalibleGoodsList.get(i);%>
					<div>경매 물품 번호:<%=curGoods.get("GOODS_SEQ") %> / <%=curGoods.get("GOODS_NAME") %> / 타입:<%=curGoods.get("GOODS_COMPANY") %></div>
				<%} %>
			<%}else{ %>
				<div>등록된 경매 물건이 없습니다.</div>
			<%} %>
		</div>
		
		<h2>현재 경매 진행중 물건</h2>
		<div>
			<%if(registedGoodsList!=null && registedGoodsList.size()>0){ 
				for(int i = 0; i< registedGoodsList.size();i++){
					SoptHashMap curGoods = (SoptHashMap)registedGoodsList.get(i);%>
					<div>경매 물품 번호:<%=curGoods.get("GOODS_SEQ") %> / <%=curGoods.get("GOODS_NAME") %> / 타입:<%=curGoods.get("GOODS_COMPANY") %></div>
				<%} %>
			<%}else{ %>
				<div>진행중 경매 물건이 없습니다.</div>
			<%} %>
		</div>
		
		<h2>현재 낙찰된 물건</h2>
		<div>
			<%if(awardedGoodsList!=null && awardedGoodsList.size()>0){ 
				for(int i = 0; i< awardedGoodsList.size();i++){
					SoptHashMap curGoods = (SoptHashMap)awardedGoodsList.get(i);%>
					<div>경매 물품 번호:<%=curGoods.get("GOODS_SEQ") %> / <%=curGoods.get("GOODS_NAME") %> / 타입:<%=curGoods.get("GOODS_COMPANY") %></div>
				<%} %>
			<%}else{ %>
				<div>낙찰된 경매 물건이 없습니다.</div>
			<%} %>
		</div>
	</div>
	<iframe name="ifr" id="ifr"></iframe>
</body>
</html>